
/*弹出层*/
/*
    参数解释：
    title   标题
    url     请求的url
    id      需要操作的数据id
    w       弹出层宽度（缺省调默认值）
    h       弹出层高度（缺省调默认值）
*/
function onmousemoves(){
    var tipsinfo = null;
    $('td .layuimsg').hover(function(){
        var msg = $(this).attr('tipsmsg');
        tipsinfo = layer.tips(msg, this,{
            tips: 1 //还可配置颜色
        });
    },function(){
        layer.close(tipsinfo);
    })
}


$('.onmousemovebtns').hover(function(){
    var msg = $(this).attr('tipsmsg');
    tipsinfo = layer.tips(msg, this,{
        tips: 1 //还可配置颜色
    });
},function(){
    layer.close(tipsinfo);
})

/*var tipsinfos = null;
function onmousemovebtn(thiss){
    var msg = $(thiss).attr('tipsmsg');
    tipsinfos = layer.tips(msg, thiss,{
        tips: 1 //还可配置颜色
    });
}

function onmouseoutbtn(thiss){
    layer.close(tipsinfos);
    tipsinfos = null;
}*/

function x_admin_show(title,url,w,h,sw,sh){
    if (title == null || title == '') {
        title=false;
    };
    if (w == null || w == '') {
        w=($(window).width()*0.9)+'px';
    };
    if (h == null || h == '') {
        h=($(window).height() - 50)+'px';
    };
    if (sw == null || sw == '') {
        sw='95%';
    };
    if (sh == null || sh == '') {
        sh='95%';
    };
    layer.open({
        type: 2,
        title: title,
        content: url,
        skin: 'layui-layer-admin',
        fix: false, //不固定
        maxmin: true,
        shadeClose: true,
        //closeBtn: 2,
        shade:0.4,
        anim: 1,
        area: screen() < 2 ? [sw, sh] : [w, h],
        end:function(){
            window.location.reload();
        }
    });

}

function opens(title,w,h,sw,sh,contents){
    layer.open({
        type: 1,
        title: title,
        skin: 'layui-layer-admin',
        shadeClose: true,
        shade: false,
        maxmin: true, //开启最大化最小化按钮
        shade:0.4,
        anim: 1,
        //area: screen() <2 ? ['95%','300px'] : ['400px', '310px'],
        area: screen() <2 ? [w,h] : [sw,sh],
        content: contents
    });
}

//判断浏览器大小方法
function screen() {
    //获取当前窗口的宽度
    var width = $(window).width();
    if (width > 1200) {
        return 3;   //大屏幕
    } else if (width > 992) {
        return 2;   //中屏幕
    } else if (width > 768) {
        return 1;   //小屏幕
    } else {
        return 0;   //超小屏幕
    }
}
/*关闭弹出框口*/
function x_admin_close(){
    var index = parent.layer.getFrameIndex(window.name);
    parent.layer.close(index);
}


